using UnityEngine;
using System.Collections;

public class ScenePause : AndroidMenu 
{
	void Start()
	{
		base._manager = gameObject.GetComponent<MenuManager>();
		base.amount = _manager.amount;
		
		gameObject.AddComponent("InputManager");
	}

	void OnTouchOver(GameObject go)
	{
		if(go.name != "_Pause")
		{
			if(!go.GetComponent<SpecialCube>() && ready)
				go.AddComponent("SpecialCube");
		}
	}
	
	void OnTouchExit(GameObject go)
	{
		if(go.name != "_Pause")
		{
			if(go.GetComponent<SpecialCube>() && ready)
				Destroy(go.GetComponent<SpecialCube>());
		
			go.renderer.material.color = Color.black;
		}
	}
	
	void OnTouchUp(GameObject go)
	{
		if(ready)
		{
			switch(go.name)
			{
				case "Reiniciar":
					_manager.changeSceneAtName(Application.loadedLevelName);
					break;
				
				case "Selecao":
					_manager.changeSceneAtName("Selection");
					break;
				
				case "Retomar":
				Camera.mainCamera.gameObject.GetComponent<Pause>().Return();
					break;
				
				case "Voltar ao Menu":
					_manager.changeSceneAtName("MainMenu");
					break;
			}
	
		}
	}
	
	void Ready()
	{
		ready = true;
	}
}
	